package com.czk.springdatar2dbc.repository;

import com.czk.springdatar2dbc.entity.TBook;
import com.czk.springdatar2dbc.vo.BookVO;
import org.springframework.data.r2dbc.repository.Query;
import org.springframework.data.r2dbc.repository.R2dbcRepository;
import reactor.core.publisher.Mono;

/**
 * @Author: chenzhangkun
 * @CreateTime: 2025-05-28
 * @Description:
 * @Version: 1.0
 */
public interface TBookRepository extends R2dbcRepository<TBook, Long> {

    @Query("""
                    select b.*,t.name as name from t_book b 
                    left join t_author t on b.author_id  =t.id
                    where b.id=?
            
            """)
    Mono<BookVO> findBookAndAuthor(Long bookId);


}
